﻿#include "forward_server.h"

forward_server::forward_server(QObject *parent) : QTcpServer(parent)
{
    
}

void forward_server::startServer()
{
    if(!this->isListening())
    {
        qDebug()<<"开启服务";
        this->listen(m_Address,m_Port);
    }
}

void forward_server::stopServer()
{
    this->close();
}

void forward_server::incomingConnection(qintptr socketDescriptor)
{
    qDebug()<<"新客户连接";
    auto thread = new forward_Control(socketDescriptor);
    connect(thread,&forward_Control::finished,thread,&forward_Control::deleteLater,Qt::DirectConnection);
    thread->start();
}

